<? if (count($results) > 0): ?>

        <div id="filter" class="frm_color">

            <div id="filter_wrap">

                <h3 class="filter_by" style="margin-top: 4px"><?= lang('filter.title'); ?>:</h3>



                <div class="collapse-filter accordion">

                    <h3 class="filter_title"><?= lang('filter.price_by_night'); ?></h3>


                    <div class="filteroptions" id="filter_price">

                        <? if (isset($unique_prices['0,50'])): ?>

                            <a data-category="filter_price" data-id="0,50" class="filterelement inactive" href="javascript:" rel="nofollow">

                                <div class="filter_item clearfix"><span><?= currency_sign() ?>&nbsp;0 - <?= currency_sign() ?>&nbsp;<?= ceil($rate * 49) ?></span> (<?= $unique_prices['0,50']->cnt ?>)</div>

                            </a>

                        <? endif; ?>

                        <? if (isset($unique_prices['50,100'])): ?>
                            <a data-category="filter_price" data-id="50,100" class="filterelement inactive" href="javascript:" rel="nofollow">

                                <div class="filter_item clearfix"><span><?= currency_sign() ?>&nbsp;<?= ceil($rate * 50) ?> - <?= currency_sign() ?>&nbsp;<?= ceil($rate * 99) ?></span> (<?= $unique_prices['50,100']->cnt ?>)</div>

                            </a>
                        <? endif; ?>

                        <? if (isset($unique_prices['100,150'])): ?>
                            <a data-category="filter_price" data-id="100,150" class="filterelement inactive" href="javascript:" rel="nofollow">

                                <div class="filter_item clearfix"><span><?= currency_sign() ?>&nbsp;<?= ceil($rate * 100) ?> - <?= currency_sign() ?>&nbsp;<?= ceil($rate * 149) ?></span> (<?= $unique_prices['100,150']->cnt ?>)</div>

                            </a>
                        <? endif; ?>

                        <? if (isset($unique_prices['150,200'])): ?>
                            <a data-category="filter_price" data-id="150,200" class="filterelement inactive" href="javascript:" rel="nofollow">

                                <div class="filter_item clearfix"><span><?= currency_sign() ?>&nbsp;<?= ceil($rate * 150) ?> - <?= currency_sign() ?>&nbsp;<?= ceil($rate * 199) ?></span> (<?= $unique_prices['150,200']->cnt ?>)</div>

                            </a>
                        <? endif; ?>

                        <? if (isset($unique_prices['200,-1'])): ?>
                            <a data-category="filter_price" data-id="200,-1" class="filterelement inactive" href="javascript:" rel="nofollow">

                                <div class="filter_item clearfix"><span><?= currency_sign() ?>&nbsp;<?= ceil($rate * 200) ?> +</span> (<?= $unique_prices['200,-1']->cnt ?>)</div>

                            </a>
                        <? endif; ?>

                    </div>






                    <h3 class="filter_title"><?= lang('filter.star_rating'); ?></h3>


                    <div class="filteroptions" id="filter_stars">

                        <?
                        foreach ($unique_stars as $key => $value):
                            if ($key != 0):
                                ?>

                                <a data-category="filter_stars" data-id="<?= $key ?>" class="filterelement inactive" href="javascript:" rel="nofollow">

                                    <div class="filter_item clearfix"><span><?= $key ?> <?= $key == 1 ? lang('filter.star') : lang('filter.stars') ?></span> (<?= $value ?>)</div>

                                </a>

                                <?
                            endif;
                        endforeach;
                        ?>

                        <? if (isset($unique_stars[0])): ?>

                            <a data-category="filter_stars" data-id="0" class="filterelement inactive" href="javascript:" rel="nofollow">

                                <div class="filter_item clearfix"><span><?= lang('filter.unrated'); ?></span> (<?= $unique_stars[0] ?>)</div>

                            </a>

                        <? endif; ?>

                    </div>



                    <h3 class="filter_title"><?= lang('filter.distances'); ?></h3>


                    <div class="filteroptions" id="filter_distances">

                        <?
                        $show_beach = FALSE;
                        $show_center = FALSE;

                        foreach ($results as $item) :

                            if (isset($item->object_distance_from_the_sea) && $item->object_distance_from_the_sea != "")
                                $show_beach = TRUE;

                            if (isset($item->object_distance_from_the_center) && $item->object_distance_from_the_center != "")
                                $show_center = TRUE;

                        endforeach;
                        ?>

                        <? if ($show_beach): ?>
                            <div>
                                <span><?= lang('filter.beach_within'); ?>:</span><span id="beach_distance" class="value-distance"><?= lang('filter.no_preference'); ?></span>

                                <div id="slider-distances-beach" class="slider" data-id="beach_distance"></div>

                            </div>
                        <? endif; ?>

                        <? if ($show_center): ?>
                            <div>
                                <span><?= lang('filter.center_within'); ?>:</span><span id="center_distance" class="value-distance"><?= lang('filter.no_preference'); ?></span>
                                <div id="slider-distances-center" class="slider"  data-id="center_distance"></div>

                            </div>
                        <? endif; ?>



                    </div>

                    <h3 class="filter_title"><?= lang('filter.facilities_services'); ?></h3>

                    <div class="filteroptions" id="filter_facilities_services">

                        <?
                        if (isset($unique) && count($unique) > 0)
                            foreach ($unique as $attribute):
                                ?>

                                <a data-category="filter_facilities" data-id="<?= $attribute->id ?>" class="filterelement inactive" href="javascript:" rel="nofollow">

                                    <div class="filter_item clearfix"><span><?= $attribute->title ?></span> (<?= $attribute->cnt ?>)</div>

                                </a>

                            <? endforeach; ?>

                    </div>

                </div>

            </div>
        </div>
    <? endif; ?>